﻿using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using iSchool.RabbitMQ.Message;
using ProductManagement.Framework.RabbitMQ;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace iSchool.RabbitMQ.Handle
{
    public class SyncTopicAddHandle : IEventHandler<SyncTopicAddMessage>
    {
        private readonly ILogger<SyncTopicAddHandle> _logger;

        public SyncTopicAddHandle(ILogger<SyncTopicAddHandle> logger)
        {
            _logger = logger;
        }

        public Task Handle(SyncTopicAddMessage message)
        {
            try
            {
                SendMessage(message);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "操作异常,数据:{0}", JsonConvert.SerializeObject(message));
            }
            return Task.CompletedTask;
        }

        private void SendMessage(SyncTopicAddMessage message)
        {


        }
    }
}
